package algebra.visitors.cursors;

import algebra.op.ConstantOP;
import entities.assertion.ConceptAssertion;
import entities.assertion.StarConceptAssertion;
import entities.concept.Concept;

public class CACursorConstant extends CACursor {

	private final ConstantOP op;
	private int count;

	public CACursorConstant(ConstantOP op) {
		this.op = op;
	}

	@Override
	public boolean openCursor() {
		this.count = 0;
		return true;
	}

	@Override
	public ConceptAssertion getNextResult() {
		if (this.count > 0) {
			return null;
		}
		this.count++;
		Concept c = op.getQueryCocnept();
		return new StarConceptAssertion(c);
	}

	@Override
	public boolean isSortedById() {
		return true;
	}

}
